//
//  YGJMainTabVC.m
//  ygj-customer-iOS
//
//  Created by apple on 16/11/10.
//  Copyright © 2016年 apple. All rights reserved.
//

#import "YGJMainTabVC.h"

#import "YGJOrderVC.h"
#import "YGJHomeVC.h"
#import "YGJDiscoverVC.h"
#import "YGJMyVC.h"

#import "YGJNavigationController.h"

@interface YGJMainTabVC ()

@end

@implementation YGJMainTabVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self showTab];
    self.tabBarController.tabBar.backgroundColor = [UIColor whiteColor];
    self.tabBarController.delegate = self;
    self.delegate = self;
}

#pragma mark 展示tab
-(void) showTab {
    NSArray * imageArr = @[@"index-off1",@"order-off1",@"discover-off1",@"my-off1"];
    NSArray * selectedImageArr = @[@"index-on1",@"order-on1",@"discover-on1",@"my-on1"];
    NSArray * titlesArr = @[@"首页",@"订单",@"发现",@"我的"];
    NSArray * VCArr = @[@"YGJHomeVC",@"YGJOrderVC",@"YGJDiscoverVC",@"YGJMyVC"];
    NSMutableArray * viewcontrollers = [NSMutableArray array];
    for (int i=0;i<VCArr.count;i++) {
        Class cla = NSClassFromString(VCArr[i]);
        UIViewController * vc = [[cla alloc] init];
        vc.title = titlesArr[i];
        vc.tabBarItem.image = [UIImage imageNamed:imageArr[i]];
        vc.tabBarItem.selectedImage = [UIImage imageNamed:selectedImageArr[i]];
        YGJNavigationController * nvc = [[YGJNavigationController alloc] initWithRootViewController:vc];
        nvc.tabBarController.tabBar.translucent = NO;
        [viewcontrollers addObject:nvc];
    }
    self.viewControllers = viewcontrollers;
    

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
